<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Generator::Context
  
    &mdash; Documentation by YARD 0.8.7.6
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!Generator/Context.html";
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (C)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Generator.html" title="Generator (module)">Generator</a></span></span>
     &raquo; 
    <span class="title">Context</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: Generator::Context
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Generator::Context</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
      <dt class="r2">Includes:</dt>
      <dd class="r2">ActionView::Helpers, <span class='object_link'><a href="../ActivesupportOverride.html" title="ActivesupportOverride (module)">ActivesupportOverride</a></span></dd>
      
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/generator/haml_generator.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>Calls to “render” can take a context object that will be accessible from
the templates.</p>


  </div>
</div>
<div class="tags">
  

</div>



  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#example_boolean-instance_method" title="#example_boolean (instance method)">- (Object) <strong>example_boolean</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Any properties of this object are available in the Haml templates.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Context) <strong>initialize</strong>(example_boolean, scope, options, input_folder, output_folder) </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>A new instance of Context.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#render_partial-instance_method" title="#render_partial (instance method)">- (Object) <strong>render_partial</strong>(file_name) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>This function is no different from the “copyright_year” function above.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="../ActivesupportOverride.html" title="ActivesupportOverride (module)">ActivesupportOverride</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="../ActivesupportOverride.html#external_path%3F-instance_method" title="ActivesupportOverride#external_path? (method)">#external_path?</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#javascript_include_tag-instance_method" title="ActivesupportOverride#javascript_include_tag (method)">#javascript_include_tag</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#link_tag-instance_method" title="ActivesupportOverride#link_tag (method)">#link_tag</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#meta_tag-instance_method" title="ActivesupportOverride#meta_tag (method)">#meta_tag</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#meta_tag_http-instance_method" title="ActivesupportOverride#meta_tag_http (method)">#meta_tag_http</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#path_to_css-instance_method" title="ActivesupportOverride#path_to_css (method)">#path_to_css</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#path_to_image-instance_method" title="ActivesupportOverride#path_to_image (method)">#path_to_image</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#path_to_js-instance_method" title="ActivesupportOverride#path_to_js (method)">#path_to_js</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#stylesheet_link_tag-instance_method" title="ActivesupportOverride#stylesheet_link_tag (method)">#stylesheet_link_tag</a></span>, <span class='object_link'><a href="../ActivesupportOverride.html#url_for-instance_method" title="ActivesupportOverride#url_for (method)">#url_for</a></span></p>

  <div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Generator::Context (class)">Context</a></span></tt>) <strong>initialize</strong>(example_boolean, scope, options, input_folder, output_folder) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns a new instance of Context</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


66
67
68
69
70
71
72
73
74
75
76
77
78
79</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/generator/haml_generator.rb', line 66</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_example_boolean'>example_boolean</span><span class='comma'>,</span> <span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_input_folder'>input_folder</span><span class='comma'>,</span> <span class='id identifier rubyid_output_folder'>output_folder</span><span class='rparen'>)</span>
  <span class='ivar'>@example_boolean</span> <span class='op'>=</span> <span class='id identifier rubyid_example_boolean'>example_boolean</span>
  <span class='ivar'>@scope</span> <span class='op'>=</span> <span class='id identifier rubyid_scope'>scope</span>
  <span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span>
  <span class='ivar'>@input_folder</span> <span class='op'>=</span> <span class='id identifier rubyid_input_folder'>input_folder</span>
  <span class='ivar'>@output_folder</span> <span class='op'>=</span> <span class='id identifier rubyid_output_folder'>output_folder</span>
  <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_glob'>glob</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>./</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_input_folder'>input_folder</span><span class='embexpr_end'>}</span><span class='tstring_content'>/helper/*.rb</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
    <span class='id identifier rubyid_require'>require</span> <span class='id identifier rubyid_path'>path</span>
    <span class='id identifier rubyid_file_without_ext'>file_without_ext</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
    <span class='id identifier rubyid_module_name'>module_name</span>      <span class='op'>=</span> <span class='id identifier rubyid_file_without_ext'>file_without_ext</span><span class='period'>.</span><span class='id identifier rubyid_classify'>classify</span>
    <span class='const'>STDERR</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>loading project helper -&gt; </span><span class='tstring_end'>&#39;</span></span><span class='op'>+</span><span class='id identifier rubyid_module_name'>module_name</span>
    <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:include</span><span class='comma'>,</span> <span class='id identifier rubyid_module_name'>module_name</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="example_boolean-instance_method">
  
    - (<tt>Object</tt>) <strong>example_boolean</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Any properties of this object are available in the Haml templates.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


54
55
56</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/generator/haml_generator.rb', line 54</span>

<span class='kw'>def</span> <span class='id identifier rubyid_example_boolean'>example_boolean</span>
  <span class='ivar'>@example_boolean</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="render_partial-instance_method">
  
    - (<tt>Object</tt>) <strong>render_partial</strong>(file_name) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>This function is no different from the “copyright_year” function above. It
just uses some conventions to render another template file when it&#39;s
called.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/generator/haml_generator.rb', line 83</span>

<span class='kw'>def</span> <span class='id identifier rubyid_render_partial'>render_partial</span><span class='lparen'>(</span><span class='id identifier rubyid_file_name'>file_name</span><span class='rparen'>)</span>
  <span class='comment'># The &quot;default&quot; version of the partial.
</span>  <span class='id identifier rubyid_file_to_render'>file_to_render</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@input_folder</span><span class='embexpr_end'>}</span><span class='tstring_content'>/partials/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_name'>file_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'>.haml</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>if</span> <span class='ivar'>@scope</span>
    <span class='comment'># Look for a partial prefixed with the current &quot;scope&quot; (which is just the name of the
</span>    <span class='comment'># primary template being rendered).
</span>    <span class='id identifier rubyid_scope_file'>scope_file</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@input_folder</span><span class='embexpr_end'>}</span><span class='tstring_content'>/partials/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@scope</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_name'>file_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_content'>.haml</span><span class='tstring_end'>&quot;</span></span>
    <span class='comment'># Use it if it&#39;s there.
</span>    <span class='id identifier rubyid_file_to_render'>file_to_render</span> <span class='op'>=</span> <span class='id identifier rubyid_scope_file'>scope_file</span> <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span> <span class='id identifier rubyid_scope_file'>scope_file</span>
  <span class='kw'>end</span>
  <span class='comment'># If we found a matching partial (either the scoped one or the default), render it now.
</span>  <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span> <span class='id identifier rubyid_file_to_render'>file_to_render</span>
    <span class='id identifier rubyid_partial'>partial</span> <span class='op'>=</span> <span class='const'>Haml</span><span class='op'>::</span><span class='const'>Engine</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_file_to_render'>file_to_render</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='ivar'>@options</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_partial'>partial</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span> <span class='kw'>self</span>
  <span class='kw'>else</span>
    <span class='kw'>nil</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Sun Dec 21 19:55:50 2014 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.6 (ruby-2.1.3).
</div>

  </body>
</html>